package cn.tedu.lianxi7;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;

public class Text1 {
	public static void main(String[] args) {
		LinkedList<Integer> a=new LinkedList<>();
	    ArrayList<Integer> b=new ArrayList<Integer>();
	    long s1=System.currentTimeMillis();
	    for (int i = 0; i < 100000; i++) {
	    	b.add(10);
	    }
	    long e1=System.currentTimeMillis();
	    System.out.println(e1-s1);
		long s=System.currentTimeMillis();
	    for (int i = 0; i < 100000; i++) {
			a.add(10);
		}
	    long e=System.currentTimeMillis();
	    System.out.println(e-s);
	    long t = System.currentTimeMillis();
        Iterator it = a.iterator();
        while(it.hasNext()) {
               it.next();
        }
        t = System.currentTimeMillis()-t;
        System.out.println("=====iterator========="+t);//16
        long t1 = System.currentTimeMillis();
        for (int i = 0; i < a.size(); i++) {
               a.get(i);
        }
        long t2 = System.currentTimeMillis();
        System.out.println("~~~~for~~~~~~~"+(t2-t1));   
        long s2=System.currentTimeMillis();
	    a.addLast(20);;
	    long e2=System.currentTimeMillis();
	    System.out.println(e2-s2);
	    long s3=System.currentTimeMillis();
	    b.add(99999, 20);
	    long e3=System.currentTimeMillis();
	    System.out.println(e3-s3);
	    
	}

}
